import fetch from '@/utils/fetch'
import {getUserId} from '@/utils/token'

export function apiAddRepair (Dto) {
  Dto.userId = getUserId()
  return fetch({
    url: '/api/v1/maintenanceRecord',
    method: 'POST',
    data: Dto
  })
}

export function apiGetRepairList (listQuery) {
  return fetch({
    url: '/api/v1/maintenanceRecord/list',
    method: 'GET',
    params: listQuery
  })
}

export function apiUpdRepair (dto) {
  return fetch({
    url: '/api/v1/acceptOrder',
    method: 'put',
    data: dto
  })
}

export function apiDelRepair (id) {
  return fetch({
    url: '/api/v1/acceptOrder',
    method: 'delete',
    params: {
      id: id
    }
  })
}

export function apiUpdPointRepair (acceptOrderDto) {
  return fetch({
    url: 'api/v1/maintenanceRecord/updStatus',
    method: 'put',
    data: acceptOrderDto
  })
}

// 根据工单id获取发票信息
export function apiGetInvoice (applicationId) {
  return fetch({
    url: 'api/v1/maintenanceRecord/invoice',
    method: 'get',
    params: {
      applicationId: applicationId
    }
  })
}

